package demo3;


import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lyw
 * Date: 2025-03-18
 * Time: 22:28
 */
public class Test {
    public static void main(String[] args) {
         Student student1 = new Student("张三",18);
        Student student2 = new Student("李四",19);

        Student[] students = new Student[3];
        students[0] = new Student("zhangsan",18);
        students[1] = new Student("lisi",20);
        students[2] = new Student("wangwu",11);
        System.out.println("排序前：" + Arrays.toString(students));
        NameComparator nameComparator = new NameComparator();
        Arrays.sort(students,nameComparator);
        System.out.println("排序后：" + Arrays.toString(students));
        int ret = nameComparator.compare(student1,student2);
        System.out.println(ret);
    }
}
